<?php


namespace app\hscms\service;


use think\admin\extend\DataExtend;
use think\admin\Service;



class LanmuService extends Service
{
    /**
     * 获得栏目信息
     */
    public function getCateList(string $type = 'arr2tree'): array
    {
        $query = $this->app->db->name('HscmsLanmu')->order('id asc');
        $cates = DataExtend::$type($query->withoutField('sort,status,deleted,create_at')->select()->toArray());
        if ($type === 'arr2table') foreach ($cates as &$vo) {
            $vo['sat'] = $vo['spt'] !== $this->getCateLevel() - 1 ? 'disabled' : '';
        }
        return $cates;
    }
}